#!/usr/bin/env python
# -*- encoding: utf-8 -*-
'''
@File    :   get_Freq.py
@Time    :   2021/12/01 10:54:33
@Author  :   glx 
@Version :   1.0
@Contact :   18095542g@connect.polyu.hk
@Desc    :   To get matlab out put data

'''
__all__ = ["get_data", "read_data"]

# here put the import lib
import pandas as pd
import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import os
import sys


def get_data(data_url, column):
    """获取csv文件的路径 """
    csv_list = [i for i in os.listdir(r'.\data') if i.endswith('.csv') and i != "sat1.csv" ]
    # 生成列名
    column = ["longitude", "latitude", "pos_x", "pos_y", "pos_z", "v_x", "v_y", "v_z", "velosity"]
    # 获取data_dict:{"文件名":data}"}
    data_dict = {}
    for url in csv_list:
        data_dict[url.split(".")[0]] = read_data('./data/' + url, column)
    return data_dict

def read_data(data_url, column):
    """ 整理成pandas的dataframe格式 """
    data = pd.read_csv(data_url)
    data.columns = column
    return data

if __name__ == "__main__":
    output_data_folder = "data\out_put"

    # 获取所有output文件夹下的csv文件
    data_dict = get_data(output_data_folder)
    

